<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	 xmlns:p="http://primefaces.org/ui"
	xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
	xmlns:h="http://java.sun.com/jsf/html"
	template="/WEB-INF/templates/adminTheme.xhtml">
	<ui:define name="content-header">
		<section class="content-header">
			<h1>
				Dashboard <small>Control panel</small>
			</h1>
			<ol class="breadcrumb">
				<li><a href="#{request.contextPath}/admin/"><i class="fa fa-dashboard"></i> Home</a></li>
				<li class="active">View Code</li>
			</ol>
		</section>
	</ui:define>
	<ui:define name="content-main">
		<!-- Small boxes (Stat box) -->
		<div class="row">
			<div class="col-md-12">
				<div class="box box-success">
					<div class="box-header">
						<h3 class="box-title">Codes</h3>
						<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />
						 <p:growl id="growl" showDetail="true" sticky="true" /> 
					</div>
					<div class="box-body">
						<h:form id="form-view-code">
							<div class="panel panel-default">
								<div class="panel-heading">
									<div class="btn-group">
									 <p:commandButton value="View" icon="ui-icon-extlink" styleClass="btn btn-default" action="#{vcb.viewCode('v')}" />
									  <p:commandButton value="Edit" icon="ui-icon-extlink" styleClass="btn btn-default" action="#{vcb.viewCode('e')}" />
									  <p:commandButton value="Edit List Student" icon="ui-icon-extlink" styleClass="btn btn-default" action="#{vcb.viewCode('cs')}" />
									</div>
								</div>
								<p:dataTable id="viewCodeDT" var="code" value="#{vcb.codesView}"  selection="#{vcb.selectView}"  rowKey="#{code.codeNo}">
									<p:ajax event="rowSelect"  listener="#{vcb.loadDt()}"  update=":form-view-code" />
       								<p:ajax event="rowUnselect" listener="#{vcb.loadDt()}" update=":form-view-code :growl" />
									<p:column selectionMode="multiple" style="width:40px;text-align:center"/>
									<p:column headerText="Id">
										<h:outputText value="#{code.codeNo}" />
									</p:column>
									<p:column headerText="Name">
										<h:outputText value="#{code.codeName}" />
									</p:column>
									<p:column headerText="Student">
										<h:outputText value="#{code.student.size()}" />
									</p:column>

								</p:dataTable>
							</div>
						</h:form>
					</div>
					<!-- /.box-body -->
				</div>
				<!-- /.box -->



			</div>
		</div>
		<!-- /.row (main row) -->
	</ui:define>



</ui:composition>
